package bmatch.tech.hello.dao;

import bmatch.tech.hello.dataobject.XuzhanUser;
import java.util.List;

import org.apache.ibatis.annotations.*;
import org.apache.ibatis.type.JdbcType;
@Mapper
public interface XuzhanUserMapper {
    @Delete({
        "delete from xuzhan_user",
        "where id = #{id,jdbcType=INTEGER}"
    })
    int deleteByPrimaryKey(Integer id);

    @Insert({
        "insert into xuzhan_user (id, num_pone, ",
        "mail, id_user, pass, ",
        "sex, time_record, ",
        "time_mod)",
        "values (#{id,jdbcType=INTEGER}, #{numPone,jdbcType=INTEGER}, ",
        "#{mail,jdbcType=VARCHAR}, #{idUser,jdbcType=VARCHAR}, #{pass,jdbcType=VARCHAR}, ",
        "#{sex,jdbcType=INTEGER}, now(), ",
        "now())"
    })
    int insert(XuzhanUser record);

    @Select({
        "select",
        "id, num_pone, mail, id_user, pass, sex, time_record, time_mod",
        "from xuzhan_user",
        "where id = #{id,jdbcType=INTEGER}"
    })
    @Results({
        @Result(column="id", property="id", jdbcType=JdbcType.INTEGER, id=true),
        @Result(column="num_pone", property="numPone", jdbcType=JdbcType.INTEGER),
        @Result(column="mail", property="mail", jdbcType=JdbcType.VARCHAR),
        @Result(column="id_user", property="idUser", jdbcType=JdbcType.VARCHAR),
        @Result(column="pass", property="pass", jdbcType=JdbcType.VARCHAR),
        @Result(column="sex", property="sex", jdbcType=JdbcType.INTEGER),
        @Result(column="time_record", property="timeRecord", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="time_mod", property="timeMod", jdbcType=JdbcType.TIMESTAMP)
    })
    XuzhanUser selectByPrimaryKey(Integer id);

    @Select({
        "select",
        "id, num_pone, mail, id_user, pass, sex, time_record, time_mod",
        "from xuzhan_user"
    })
    @Results({
        @Result(column="id", property="id", jdbcType=JdbcType.INTEGER, id=true),
        @Result(column="num_pone", property="numPone", jdbcType=JdbcType.INTEGER),
        @Result(column="mail", property="mail", jdbcType=JdbcType.VARCHAR),
        @Result(column="id_user", property="idUser", jdbcType=JdbcType.VARCHAR),
        @Result(column="pass", property="pass", jdbcType=JdbcType.VARCHAR),
        @Result(column="sex", property="sex", jdbcType=JdbcType.INTEGER),
        @Result(column="time_record", property="timeRecord", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="time_mod", property="timeMod", jdbcType=JdbcType.TIMESTAMP)
    })
    List<XuzhanUser> selectAll();

    @Update({
        "update xuzhan_user",
        "set num_pone = #{numPone,jdbcType=INTEGER},",
          "mail = #{mail,jdbcType=VARCHAR},",
          "id_user = #{idUser,jdbcType=VARCHAR},",
          "pass = #{pass,jdbcType=VARCHAR},",
          "sex = #{sex,jdbcType=INTEGER},",
          "time_mod = now()",
        "where id = #{id,jdbcType=INTEGER}"
    })
    int updateByPrimaryKey(XuzhanUser record);
}